package goods;

import common.conf.*;

import java.util.*;

public class GoodsInfomation
{
	private Hashtable goodsInfoTable;

	private String gcode;
	private String gname;
	private String addSort;
	private String numberType;
	private String regId;
	private String regDate;
	private String regIp;
	private String updId;
	private String updDate;
	private String updIp;

	private int perPage;

	public GoodsInfomation(String gcode)
	{
		this.gcode = gcode;
		setGoodsInfo();
	}

	private void setGoodsInfo()
	{
		ReadConf rc = ReadConf.getReadConf();
		Hashtable confTable = rc.getConfTable();
		ArrayList goodsInfoList = (ArrayList)confTable.get("goodsInfoList");
		for(int i=0; i<goodsInfoList.size(); i++)
		{
			Hashtable goodsInfoTable = (Hashtable)goodsInfoList.get(i);
			String gcode = (String)goodsInfoTable.get("GKIND");
			if(gcode.equals(this.gcode))
			{
				this.goodsInfoTable = goodsInfoTable;
				this.gname = (String)goodsInfoTable.get("GKNAME");
				this.addSort = (String)goodsInfoTable.get("ADD_SORT");
				this.numberType = (String)goodsInfoTable.get("NUMBER_TYPE");
				this.regId = (String)goodsInfoTable.get("REG_ID");
				this.regDate = (String)goodsInfoTable.get("REG_DATE");
				this.regIp = (String)goodsInfoTable.get("REG_IP");
				this.updId = (String)goodsInfoTable.get("UPD_ID");
				this.updDate = (String)goodsInfoTable.get("UPD_DATE");
				this.updIp = (String)goodsInfoTable.get("UPD_IP");

				this.perPage = Integer.parseInt((String)goodsInfoTable.get("PER_PAGE"));

				break;
			}
		}
	}

	public Hashtable getGoodsInfoTable()
	{
		return goodsInfoTable;
	}

	public String getCode()
	{
		return gcode;
	}

	public String getName()
	{
		return gname;
	}

	public String getAddSort()
	{
		return addSort;
	}

	public String getNumberType()
	{
		return numberType;
	}

	public String getRegId()
	{
		return regId;
	}

	public String getRegDate()
	{
		return regDate;
	}

	public String getRegIp()
	{
		return regIp;
	}

	public String getUpdId()
	{
		return updId;
	}

	public String getUpdDate()
	{
		return updDate;
	}

	public String getUpdIp()
	{
		return updIp;
	}

	public int getPerPage()
	{
		return perPage;
	}
}